#ifndef THESYSTEMWITHGUI_PEOPLE_H
#define THESYSTEMWITHGUI_PEOPLE_H

#include <iostream>
#include <vector>
#include <string>

//--- 基本类型定义 ---//
// vacci == vaccination, loca == location
// 函数执行状态
struct State{
    static const int OK = 0;
    static const int Error = -1;
    int StateCode;
    std::string Info;
    // explicit 避免隐式类型转换
    State(int StateCode, const char* Info) : StateCode(StateCode), Info(Info) {};
};

// 疫苗接种情况
struct Vacci{  // vaccination
    static const int NoVacci = 0;
    static const int VacciFor1 = 1;
    static const int VacciFor2 = 2;
    static const int FullyVacci = 3;
    std::string time;  // 接种时间
    std::string producer; // 生产厂家
    std::string location;  // 接种地点
};

struct NAT{
    static const int NoResult = -1;
    static const int Negative = 0;
    static const int Positive = 1;
    int result;  // 检测结果
    int hour;  // 24, 48, 72
    std::string time;  // 检测时间
    std::string GetResult() const {  // 不改变成员变量，类似于只读
        if (result == Negative) return "阴性";
        else if (result == Positive) return "阳性";
        else if (result == NoResult) return "无";
        else return "Invalid Result";
    }
};

// Person 定义
class Person{
public:
    static const int mode_name = 0;
    static const int mode_addr = 1;
    static const int mode_phone = 2;
    static const int NonCloseContact = 0;
    static const int CloseContact = 1;
    static const int Infected = 2;
    int id;  // 唯一标识符
    std::string name;  // 姓名
    std::string address;  // 住址
    std::string phone;  // 联系电话
    std::vector<std::string> locations;  // 所在地，可加上每个所在地第一次到达的日期 xx省xx市xx区
    std::vector<Vacci> vaccination;  // 疫苗接种情况
    NAT nat{};  // Nucleic Acid Test, 核酸检测情况
    int riskLevel = NonCloseContact;
    Person(int&, std::string&, std::string&, std::string&, std::vector<std::string>&, std::vector<Vacci>&, NAT&);
};

class People{
private:
    std::vector<Person> list;
public:
    State add_person();
    int find_base(const std::string& base);
    std::vector<int>* filter_loca(const std::vector<std::string>& locations);
    std::vector<std::vector<int>>* filter_nat_and_vacci(int mode);
    State update_base(int f_id, std::string& UpdatedInfo, int mode);
    State update_loca(int f_id, std::string& location);
    State update_vacci(int f_id, Vacci& vaccination);
    State update_nat(int f_id, NAT& nat);
    State update_riskLevel(int f_id, int riskLevel);
};
//--- 基本类型定义 ---//
#endif  // THESYSTEMWITHGUI_PEOPLE_H